/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package towerdefence.model;

import net.phys2d.math.ROVector2f;
import net.phys2d.math.Vector2f;
import net.phys2d.raw.Body;
import net.phys2d.raw.shapes.Shape;

/**
 *
 * @author Gussoh
 */
public abstract class Cannon extends Body implements Purchaseable {

    private Vector2f configuration;
    private static final float CONFIGURATION_MULTIPLIER = 1.0f;
    
    public Cannon(Shape shape, float mass) {
        super(shape, mass);
        configuration = new Vector2f(1.0f, 0);
    }
    
    public void shoot(CannonBall ball) {
        // ball.addExcludedBody(this); Done in cannonball instead
        ball.adjustVelocity(new Vector2f(configuration.getX() * CONFIGURATION_MULTIPLIER, configuration.getY() * CONFIGURATION_MULTIPLIER));
    }
    
    public abstract CannonBall getCannonBall();

    public Vector2f getConfiguration() {
        return configuration;
    }

    public void setConfiguration(Vector2f configuration) {
        this.configuration = configuration;
    }
    
    public abstract ROVector2f getCannonBallOrigin();
        
}
